civilization_v_customisationfandomcom-20200216-history
JFD's and Pouakai's Mercenaries/Code
Each leader is accorded a new flavour: Mercenaries. This determines the likelihood that an AI will consider to take out a Mercenary Contract. To add support to this new flavour, please see my Master Support File. If a leader does not have support for this flavour, they will default to a value of 5. This mod has been designed to be extremly modular; it is very simple to add a new Contract. In what follows, we are going to detail how to make a new Contract. Because Pouakai believes XML is easier, we shall do so in that format. Adding a New Contract A new Contract is added not disimilarly to a new Social Policy: CONTRACT_JFD_AMSAIG CONTRACT_JFD_MERCENARY TXT_KEY_CONTRACT_JFD_AMSAIG_DESC TXT_KEY_CONTRACT_JFD_AMSAIG_ADJ TXT_KEY_CONTRACT_JFD_AMSAIG_TEXT ERA_CLASSICAL ERA_ANCIENT PROMOTION_JFD_AMSAIG 3 25 ICON_GOLD Here, we can see a few familiar tags: Description determines the name of the Contract, Adjective determines the denonym by which its units are known, and Civilopedia is a short blurb about the Contract's givers. Others are intuitive: PromotionType determines the unique promotion that a Contract's units come withthis promotion is absolutely necessary. If a Contract does not have this filled, it will be ignored., Rating determines the quality of that Contract, Turns determine its length, and the PrereqEra and ObsoleteEra tags determine when that Contract becomes available and when it does notyou may leave ObsoleteEra as null if the Contract does not become obsolete.. Finally, YieldCost is used to specify whether the Contract should be purchased with Gold ( ) or Faith ( ). There are also a few additional tags which are not needed, but which you may wish to make use of: IsSlavery '''determines whether the Contract's units are slaves (and will become unavailable with Sovereignty's 'Emancipation Reform'), '''PrereqReligion specifies that the player must have founded a specific religion (or must have a specific State Religion with Piety) before they can take this Contract, and PrereqCivilization'' ''specifies that the player must be a specific civilization. Once the body of your Contract is created, there are two more steps. The first is in assigning what units that Contract should be allowed to offer. This can be specified by a particular unit type, a particular unit class, or a particular combat type. Although you may only choose from one of these, there is no limit to the number of unit types, classes, or combat types that a Contract can pick from. CONTRACT_JFD_AMSAIG UNITCOMBAT_ARCHER CONTRACT_JFD_AMSAIG JFD_Northern UNITCOMBAT_MELEE Here, we are detailing that the Amsaig Contract may choose any unit from the Archer (a.k.a. Ranged) combat type, whilst only picking units from the Melee combat type that belong to a civilization from the Northern culture group. However, if a unit like this cannot be found, it will instead choose a default melee unit. If you instead wish the Contract to become unavailable if this happens, you must set the 'UseOnlyCultureType '''tag to true. This tag is available for both the unit classes and the unit combats table. Finally, to complete your Contract you must create the promotion specified in the JFD_Contracts table above. There is, however, one thing that you must do in this process, and that is to assign that promotion to a specific dialect: PROMOTION_JFD_AMSAIG AS2D_SOUND_JFD_CELTIC With Cultural Diversity's unit dialogue component, this will override the standard dialogue used by this Contract's units for a unique one. In this case, if we were playing as the Americans, our Amsaig Mercenaries, instead of speaking American English, would speak Celtic. Note: If you wish to add a new Contract but do not want your mod to depend upon Mercenaries, you will need to copy the tables found under the CONTRACTS heading in Core/Mercenaries_Master.sql. Modding Costs, Maintenance, and Turns Finally, there is one other thing that you can modify, and that is the cost, maintenance, and duration of Contracts. In ''Mercenaries, the Jiayuguan Fort Wonder already increases the length of a Contract's duration, but you may also want to modify the costs and maintenance with one of the following tables: CREATE TABLE IF NOT EXISTS Building_JFD_ContractModifiers ( BuildingType text REFERENCES Buildings(Type) default null, CostModifier integer default 0, MaintenanceModifier integer default 0, TurnsModifier integer default 0); CREATE TABLE IF NOT EXISTS Policy_JFD_ContractModifiers ( PolicyType text REFERENCES Policies(Type) default null, CostModifier integer default 0, MaintenanceModifier integer default 0, TurnsModifier integer default 0); CREATE TABLE IF NOT EXISTS Trait_JFD_ContractModifiers ( TraitType text REFERENCES Traits(Type) default null, CostModifier integer default 0, MaintenanceModifier integer default 0, TurnsModifier integer default 0); Simply choose which is most appropriate for your needs, add the CREATE TABLE code above to your mod, and fill in the table itself as per the preceding tutorial. References